<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="IgnoreList.js"></script>
<script type="text/javascript" src="dromruparser.js"></script>
<script>
function check()
{
    current_url_index = -1;
    urls = loadUrls();
    req = null;
    downloadNextUrl(0);
}

check();
window.setInterval(function() {
      check();
    }, 60000 * 30);

function printData()
{
    chrome.browserAction.setBadgeBackgroundColor({color: [0, 255, 0, 255]});
    var count = getUnwatchedCount(urls);
    if (count > 0){
        chrome.browserAction.setBadgeText({text: count.toString()});
        saveUrls(urls);
    }
    else
        chrome.browserAction.setBadgeText({text: ""});
    var lastDate = new Date();
    localStorage["last_scan_date"] = lastDate.getFullYear() + '/' + (lastDate.getMonth() + 1) + '/' + lastDate.getDate() + ' ' + lastDate.getHours() + ':' + lastDate.getMinutes();
}

function showData()
{
    if (urls[current_url_index].url.search("drom.ru") >= 0)
        parseDromRuData();
    else
        parseGorod55Data();
    
    downloadNextUrl(current_url_index + 1);
}
</script>